<?php 
/**
 * eBay Label Printing Program Template Cell content Database Table Class 
 * this is a Db Table Class , It stores The pre-difined template for cell content 
 * after customer decide a paper , this one will be copy over to the customer cell content table 
 * customer can then modify it base on this one 
 * therefore it will not able to have some big functions ,just copy and update 
 * after this one update . the old one in the customer filed will Not update automaticlly
 * @package  eBayLabelPrinter
 * @category Models/DbTable
 * @author   Norman Dong <norman.dong@hotmail.com>
 * @version  Initial
 * @copyright LeadCasket.com
 * @link     www.leadcasket.com
 * @license  Commercial
 */
 class Model_DbTable_Template_Cellcontentprofile extends Zend_Db_Table_Abstract 
{
	/**
	 * @var string Class Table Name
	 */
	protected $_name = 'template_cell_content_profile'; 
	/**
	 * Get Seller Group By ID 
	 * Not decide what to do Yet
	 * @param int $idSeller  The Seller ID
	 * @return array  Not decide what to return 
	 */	
	public function getCellcontent($cellContentID){
		
		$row = $this->fetchRow('`id_template_cell_content_profile`='.(int)$cellContentID);
		if(!$row){
			return false;
		}
		return $row->toArray();
	}
	/**
	 * 
	 * @param int $templateProfileID
	 * @param int $templateProfileLpp
	 * @param string $cellContent
	 * @todo for the temp user , it can not add extra content into the template 
	 * for registered User, there is no such limitation as a result  need another clearer class
	 * to handler this condition,however , this should be done outside of the DB class
	 */
	public function addCellcontent($templateProfileID,$templateProfileLpp,$cellContent){
		$data = array(
				'id_template_profile' =>$templateProfileID,
				'id_lpp_template_profile'=>$templateProfileLpp,
				'cell_content'=>$cellContent,
			
		);
		$this->insert($data);
		
	}
	public function updateCellcontent($cellContentID,$templateProfileID,$templateProfileLpp,$cellContent){
		$data = array(
				'id_template_profile' =>$templateProfileID,
				'id_lpp_template_profile'=>$templateProfileLpp,
				'cell_content'=>$cellContent,
					
		);
		$this->update($data,'id_template_cell_content_profile ='.$cellContentID);
	}	
	public function deleteCellcontent($cellContentID){
		$this->delete('id_template_cell_content_profile =' . $cellContentID);
		
	}
	public function listCellcontent(){
		$rows = $this->fetchAll('1');
		if(empty($rows)){
			return false;
		}
		return $rows->toArray();
	}	
	public function getCellcontentByProfile($templateProfileID){
		$rows = $this->fetchAll('id_template_profile ='.(int)$templateProfileID);
		if(empty($rows)){
			return false;
		}
		return $rows->toArray();
		
	}
				
}
?>